package com.mv.controller;

import com.mv.pojo.Wares;
import com.mv.service.WaresService;
import com.mv.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("/mv")
public class WaresController {
    @Autowired
    private WaresService waresService;
    @GetMapping("/wares/getWaresList")
    public SysResult getWaresList(){
        List<Wares> waresList = waresService.getWaresList();
        return SysResult.success(waresList);
    }
    @GetMapping("/wares/getWaresById")
    public SysResult getWaresById(Integer id){
        Wares wares=waresService.getWaresById(id);
        return SysResult.success(wares);
    }
}
